package com.jackrain.nea.core.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

@Mapper
@Component
public interface AdTableCategoryMapper {
    @Delete("DELETE FROM ad_tablecategory WHERE id = #{id} and not exists (select 1 from ad_table where AD_TABLECATEGORY_ID = #{id})")
    int delete(long id);

    @Select("Select count(1) from ad_tablecategory WHERE id = #{id}")
    boolean exists(long id);
}
